{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import time"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1745981075.0270977"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "time.time()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "from urllib.parse import urlparse\n",
    "#\n",
    "res=urlparse(\"scheme://netloc/path;parameters?query#fragment\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Hello! World?\n"
     ]
    }
   ],
   "source": [
    "from urllib.parse import unquote\n",
    "\n",
    "encoded_str = \"Hello%21%20World%3F\"\n",
    "decoded_str = unquote(encoded_str)\n",
    "print(decoded_str)  # 输出: Hello! World?"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      ".jpg\n",
      ".png\n",
      ".html\n",
      ".zip\n",
      "None\n"
     ]
    }
   ],
   "source": [
    "import mimetypes\n",
    "\n",
    "print(mimetypes.guess_extension(\"image/jpeg\"))  # 输出: .jpeg 或 .jpg（视系统而定）\n",
    "print(mimetypes.guess_extension(\"image/png\"))   # 输出: .png\n",
    "print(mimetypes.guess_extension(\"text/html\"))   # 输出: .html\n",
    "print(mimetypes.guess_extension(\"application/zip\"))  # 输出: .zip\n",
    "print(mimetypes.guess_extension(\"image/webp\"))  # 输出: .webp"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "import re\n",
    "\n",
    "parts = re.split(r'\\s+|,|:', \"ab|c,def:ghi\")  # 支持空格(\\s+)和冒号(:)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['ab|c', 'def', 'ghi']"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "parts\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "base",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
